package com.film.admincontroller;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.film.domain.FilmType;
import com.film.service.FilmTypeService;
import com.film.service.impl.FilmTypeServiceImpl;
/**
 * 该控制类用来做电影类型的分页操作
 * @author 2119196781
 *
 */
@WebServlet("/filmTypePage.do")
public class FilmTypePageController extends HttpServlet{
	private FilmTypeService filmTypeService = new FilmTypeServiceImpl();
	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		HttpSession session = request.getSession();
		String pageNum = request.getParameter("page");
		List<FilmType> adminFilmTypes = filmTypeService.limitFilmType(Integer.parseInt(pageNum));
		List<FilmType> adminFilmType = filmTypeService.selectAllFilmType();
		session.setAttribute("adminFilmTypes", adminFilmTypes);
		session.setAttribute("adminFilmType", adminFilmType);
		response.sendRedirect("admin_jsp/filmTypeExhibition.jsp?flag="+pageNum);
		
	}
}
